<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-model指令</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .is{
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <script src="../../node_modules/vue/dist/vue.js"></script>
    <div id="app">
        <input type="text" @keyup.esc='anjian' v-model='shuju'>

        <select v-model='shuju'>
            <option value="">选择</option>
            <option value="1">北京</option>
            <option value="2">湖南</option>
            <option value="3">四川</option>
        </select>

        
        <hr>
        <div class="is">
            <input type="text" v-model.number='i'>
            + <input type="text" v-model.number='j'>
            = <span>{{i + j}}</span>
        </div>
    </div>


    <script>
        var ve = new Vue({
            el: '#app',

            methods: {
                anjian(e){
                    console.log('触发了esc按键'); 
                    // 按esc清空
                    e.target.value = '';
                },
            },
            
            data:{
                shuju:'1',
                add:1,
                
                i:1,
                j:1,
            }

        });
    </script>
</body>
</html>